<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script>
//        要求：
//        编写一个函数calculateAverage，接受一个数字数组作为参数，并返回数组的平均值。
    
        function calculateAverage(params) {
            let a = 0;
            for (let i = 0; i < params.length; i++) {
                a = a+params[i]                
            }
            console.log(a/params.length);
            
        }

        let arr = [1,20,21,10]

        calculateAverage(arr)
    
    </script>
</body>
</html>